package polymorphism;

public class Test {
    public static void main(String[] args) {
        //多态：对象多态、行为多态
        //1.对象多态
        People p1 = new Student();
        p1.run();//行为多态：编译看左边，执行看右边
        /*Student s1 = new Student();
        s1.test();*/
        Student s1 = (Student) p1;
        s1.test();

        People p2 = new Teacher();
        p2.run();//行为多态：编译看左边，执行看右边
    }
}
